package com.rest.model;

import com.rest.common.model.BaseEntity;
import com.rest.common.validate.ValidateGroup;
import io.swagger.annotations.ApiModelProperty;
import javax.persistence.*;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;

@Entity
@Table(name = "user")
public class User extends BaseEntity {
    private String name;
    private String password;

    @ApiModelProperty(value = "姓名")
    @NotEmpty(groups = {ValidateGroup.Create.class},message = "User.name.not-empty")
    @Column(name = "name", nullable = false)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @ApiModelProperty(value = "密码")
    @NotEmpty(groups = {ValidateGroup.Create.class},message = "User.password.not-empty")
    @Min(value = 6,message = "密码长度不能小于6个字符",groups = {ValidateGroup.Create.class})
    @Column(name = "password", nullable = false)
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}
